﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using FluentValidation;
using CashFlow.Admin.Models;

namespace CashFlow.Admin.Validator
{
    public class AddAdminModelValidator : AbstractValidator<AddAdminModel>
    {
        public AddAdminModelValidator()
        {
            RuleFor(x => x.ShopManagerUserId).GreaterThanOrEqualTo(0).WithMessage("店铺格式不正确！");
            RuleFor(x => x.UserName).Matches("\\w{6,15}").WithMessage("用户名格式不正确！");
            RuleFor(x => x.Pwd).Matches("\\w{6,15}").WithMessage("密码格式不正确！");
            RuleFor(x => x.Name).Matches("^[\\u4e00-\\u9fa5a-zA-Z0-9]{2,10}$").WithMessage("姓名格式不正确！");
        }
    }
}